import {createSlice} from "@reduxjs/toolkit";

const goodsSlice = createSlice({
    name: "goods",
    initialState: {
        goodsList: [
            {
                id: 1,
                name: "iphone12",
                price: 10000,
            }
        ],
    },
    reducers: {
        addGoodsList(state, {payload}) {
            state.goodsList.unshift(payload)
        }
    }
})

export const {addGoodsList} = goodsSlice.actions
export default goodsSlice.reducer